package com.base.framework.common.utils;
import org.apache.commons.codec.digest.DigestUtils;
import java.io.UnsupportedEncodingException;


/**
 * <p></p>
 *
 * @author ym
 */
public class PasswordUtil {
    private static String KEY="admin";//md5 key


    

    public static String md5Hex(String password){
 	   String tempPwd=KEY+password;
 	   return DigestUtils.md5Hex(getContentBytes(tempPwd, "utf-8"));
    }
    
    private static byte[] getContentBytes(String content, String charset) {
        if (charset == null || "".equals(charset)) {
            return content.getBytes();
        }
        try {
            return content.getBytes(charset);
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException("签名过程中出现错误,指定的编码集不对,您目前指定的编码集是:" + charset);
        }
    }
    

}
